{% extends "djdb/internal_page.html" %}

{% load common_extras %}

{% block breadcrumbs %}
<a href="/">chipradio home</a> /
<a href="/djdb/">DJ Database home</a>
{% endblock %}

{% block content %}

{% block extrahead %}
<script type="text/javascript" 
        src="/media/common/js/jquery/jquery-1.3.1.js"></script>
<script type="text/javascript" 
        src="/media/djdb/js/djdb.js"></script>
<script type="text/javascript" 
        src="/media/djdb/js/djdb_browse.js"></script>
{% endblock %}

<h3>
By: [
{% ifequal entity_kind "artist" %}
Artist
{% else %}
<a href="/djdb/browse/artist/{{ start_char }}?page_size={{ page_size }}{% ifnotequal category None %}&category={{ category }}{% endifnotequal %}{% ifnotequal reviewed None %}&reviewed=true{% endifnotequal %}">Artist</a>
{% endifequal %}
|
{% ifequal entity_kind "album" %}
Album
{% else %}
<a href="/djdb/browse/album/{{ start_char }}?page_size={{ page_size }}{% ifnotequal category None %}&category={{ category }}{% endifnotequal %}{% ifnotequal reviewed None %}&reviewed=true{% endifnotequal %}">Album</a>
{% endifequal %}
|
{% ifequal entity_kind "track" %}
Track
{% else %}
<a href="/djdb/browse/track/{{ start_char }}?page_size={{ page_size }}{% ifnotequal category None %}&category={{ category }}{% endifnotequal %}{% ifnotequal reviewed None %}&reviewed=true{% endifnotequal %}">Track</a>
{% endifequal %}
]
{% ifequal reviewed None %}
<input class="reviewed_checkbox" type="checkbox"/>
{% else %}
<input class="reviewed_checkbox" type="checkbox" checked="true"/>
{% endifequal %}
Reviewed
<br/>

Category: [
{% ifequal category None %}
All
{% else %}
<a href="/djdb/browse/{{ entity_kind }}/{{ start_char }}?page_size={{ page_size }}{% ifnotequal reviewed None %}&reviewed=true{% endifnotequal %}">All</a>
{% endifequal %}
|
{% for cat in categories %}
  {% if not forloop.first %} | {% endif %}
  {% ifequal category cat %}
{{ cat|replace:"/_/ "|capfirst }}
  {% else %}
<a href="/djdb/browse/{{ entity_kind }}/{{ start_char }}?page_size={{ page_size }}&category={{ cat }}{% ifnotequal reviewed None %}&reviewed=true{% endifnotequal %}">{{ cat|replace:"/_/ "|capfirst }}</a>
  {% endifequal %}
{% endfor %}
]
<br/>

Starts with: [
  {% ifequal start_char "all" %}
All
  {% else %}
<a href="/djdb/browse/{{ entity_kind }}/all?page_size={{ page_size }}{% ifnotequal category None %}&category={{ category }}{% endifnotequal %}{% ifnotequal reviewed None %}&reviewed=true{% endifnotequal %}">All</a>
  {% endifequal %}
|
  {% ifequal start_char "0" %}
0-9
  {% else %}
<a href="/djdb/browse/{{ entity_kind }}/0?page_size={{ page_size }}{% ifnotequal category None %}&category={{ category }}{% endifnotequal %}{% ifnotequal reviewed None %}&reviewed=true{% endifnotequal %}">0-9</a>
  {% endifequal %}
|
  {% for letter in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' %}
    {% ifequal letter start_char %}
{{ letter }}
    {% else %}
<a href="/djdb/browse/{{ entity_kind }}/{{ letter }}?page_size={{ page_size }}{% ifnotequal category None %}&category={{ category }}{% endifnotequal %}{% ifnotequal reviewed None %}&reviewed=true{% endifnotequal %}">{{ letter }}</a>
    {% endifequal %}
|
  {% endfor %}
  {% ifequal start_char "other" %}
Other
  {% else %}
<a href="/djdb/browse/{{ entity_kind }}/other?page_size={{ page_size }}{% ifnotequal category None %}&category={{ category }}{% endifnotequal %}{% ifnotequal reviewed None %}&reviewed=true{% endifnotequal %}">Other</a>
  {% endifequal %}
  {% ifequal entity_kind "album" %}
|
    {% ifequal start_char "random" %}
Random
    {% else %}
<a href="/djdb/browse/{{ entity_kind }}/random?page_size={{ page_size }}{% ifnotequal category None %}&category={{ category }}{% endifnotequal %}{% ifnotequal reviewed None %}&reviewed=true{% endifnotequal %}">Random</a>
    {% endifequal %}
  {% endifequal %}
]
</h3>

<form action="/djdb/browse/{{ entity_kind }}/{{ start_char }}" method="post">
  {{ form.as_table }}
  <input type="submit" name="update" value="Update"/>
  {% ifnotequal bookmark None %}
  <input type="hidden" id="bookmark" name="bookmark" value="{{ bookmark }}"/>
  {% endifnotequal %}
  {% ifnotequal category None %}
  <input type="hidden" name="category" value="{{ category }}"/>
  {% endifnotequal %}
</form>

{% if items %}
<form action="/djdb/browse/{{ entity_kind }}/{{ start_char }}" name="paging" method="post">
{% ifequal prev None %}
  <input disabled="disabled" type="submit" name="start" value="&lt;&lt;"/>
  <input disabled="disabled" type="submit" name="prev" onclick="document.paging.bookmark.value='{{ prev }}'" value="Previous Page"/>
{% else %}
  <input type="submit" name="start" value="&lt;&lt;"/>
  <input type="submit" name="prev" onclick="document.paging.bookmark.value='{{ prev }}'" value="Previous Page"/>
{% endifequal %}
{% ifequal next None %}
  <input disabled="disabled" type="submit" name="next" onclick="document.paging.bookmark.value='{{ next }}'" value="Next Page"/>
{% else %}
  <input type="submit" name="next" onclick="document.paging.bookmark.value='{{ next }}'" value="Next Page"/>
{% endifequal %}
  <input type="hidden" id="bookmark" name="bookmark" value=""/>
  <input type="hidden" name="page_size" value="{{ page_size }}"/>
  {% ifnotequal category None %}
  <input type="hidden" name="category" value="{{ category }}"/>
  {% endifnotequal %}
</form>

<table>
  {% for item in items %}
    {% if item.revoked %}
  <tr class="revoked">
    {% else %}
  <tr>
    {% endif %}

    <td>
    {% for tag in item.current_tags %}
      {% if tag in categories %}
      <div class="track_{{ tag }}">{{ tag|replace:"/_/ "|capfirst }}</div>
      {% endif %}
    {% endfor %}
    </td>

    {% ifequal entity_kind "artist" %}
    <td><a href="{{ item.url }}">{{ item.name }}</a></td>
    {% endifequal %}

    {% ifequal entity_kind "album" %}
    <td><a href="{{ item.url }}">{{ item.title }}</a> / <a href="{{ item.album_artist.url }}">{{ item.album_artist }}</a></td>
    <td>
      {% if item.num_reviews %}
      {{ item.num_reviews }} review{{ item.num_reviews|pluralize }}
      {% endif %}
    </td>
    {% endifequal %}
    
    {% ifequal entity_kind "track" %}
    <td>{{ item.title }} / <a href="{{ item.album.url }}">{{ item.album }}</a> / <a href="{{ item.album.album_artist.url }}">{{ item.album.album_artist }}</a></td>
    {% endifequal %}
    {% if user.is_music_director %}
    <td>
      {% ifequal entity_kind "artist" %}
        {% if item.revoked %}
      <a href="/djdb/artist/{{ item.name }}/unrevoke?response_page=browse&start_char={{ start_char }}&page_size={{ page_size }}{% if bookmark %}&bookmark={{ bookmark }}{% endif %}" title="Unrevoke artist"> <img src="/media/common/img/unrevoke_icon.png" alt="Unrevoke artist"/></a>
        {% else %}
      <a href="/djdb/artist/{{ item.name }}/revoke?response_page=browse&start_char={{ start_char }}&page_size={{ page_size}}{% if bookmark %}&bookmark={{ bookmark }}{% endif %}" title="Revoke artist"> <img src="/media/common/img/revoke_icon.png" alt="Revoke artist"/></a>
        {% endif %}
      {% else %}
      {% ifequal entity_kind "album" %}
        {% if not item.is_compilation and not item.album_artist.revoked %}
          {% if item.revoked %}
      <a href="/djdb/album/{{ item.album_id }}/unrevoke?response_page=browse&start_char={{ start_char }}&page_size={{ page_size }}{% if category %}&category={{ category }}{% endif %}{% if bookmark %}&bookmark={{ bookmark }}{% endif %}" title="Unrevoke album"> <img src="/media/common/img/unrevoke_icon.png" alt="Unrevoke album"/></a>
          {% else %}
      <a href="/djdb/album/{{ item.album_id }}/revoke?response_page=browse&start_char={{ start_char }}&page_size={{ page_size }}{% if category %}&category={{ category }}{% endif %}{% if bookmark %}&bookmark={{ bookmark }}{% endif %}" title="Revoke album"> <img src="/media/common/img/revoke_icon.png" alt="Revoke album"/></a>
          {% endif %}
        {% endif %}
      {% else %}
      {% ifequal entity_kind "track" %}
        {% if not item.album.revoked %}
          {% if item.revoked %}
      <a href="/djdb/track/{{ item.key }}/unrevoke?response_page=browse&start_char={{ start_char }}&page_size={{ page_size }}{% if bookmark %}&bookmark={{ bookmark }}{% endif %}" title="Unrevoke track"> <img src="/media/common/img/unrevoke_icon.png" alt="Unrevoke track"/></a>
          {% else %}
      <a href="/djdb/track/{{ item.key }}/revoke?response_page=browse&start_char={{ start_char }}&page_size={{ page_size }}{% if bookmark %}&bookmark={{ bookmark }}{% endif %}" title="Revoke track"> <img src="/media/common/img/revoke_icon.png" alt="Revoke track"/></a>
          {% endif %}
        {% endif %}
      {% endifequal %}{% endifequal %}{% endifequal %}
    </td>
    {% endif %}
  </tr>
  {% endfor %}
</table>

<form action="/djdb/browse/{{ entity_kind }}/{{ start_char }}" name="paging2" method="post">
{% ifequal prev None %}
  <input disabled="disabled" type="submit" name="start" value="&lt;&lt;"/>
  <input disabled="disabled" type="submit" name="prev" onclick="document.paging2.bookmark.value='{{ prev }}'" value="Previous Page"/>
{% else %}
  <input type="submit" name="start" value="&lt;&lt;"/>
  <input type="submit" name="prev" onclick="document.paging2.bookmark.value='{{ prev }}'" value="Previous Page"/>
{% endifequal %}
{% ifequal next None %}
  <input disabled="disabled" type="submit" name="next" onclick="document.paging2.bookmark.value='{{ next }}'" value="Next Page"/>
{% else %}
  <input type="submit" name="next" onclick="document.paging2.bookmark.value='{{ next }}'" value="Next Page"/>
{% endifequal %}
  <input type="hidden" id="bookmark" name="bookmark" value=""/>
  <input type="hidden" name="author_key" value="{{ author_key }}"/>
  <input type="hidden" name="page_size" value="{{ page_size }}"/>
  {% ifnotequal category None %}
  <input type="hidden" name="category" value="{{ category }}"/>
  {% endifnotequal %}
</form>
{% else %}
No items.
{% endif %}

{% endblock %}
